import os
import sys
from concurrent.futures import ThreadPoolExecutor

from fastapi import APIRouter
from api.modelsItem import AudioItem
from api.modelsItem.AudioItem import AudioSeparationResult, AudioType

audio_api_app = APIRouter()

executor = ThreadPoolExecutor(max_workers=1)


@audio_api_app.post("/fenge", response_model=AudioSeparationResult, description="音频分割", summary="人脸解析接口")
async def audio_separation(item: AudioItem.AudioSeparationItem):
    mock_data = {
        "separated_audios": [
            {"type": AudioType.VOCAL, "url": "https://example.com/vocal.mp3"},
            {"type": AudioType.BACKGROUND, "url": "https://example.com/background.mp3"}
        ],
        "original_audio_url": item.audio_url,
        "status": "success"
    }

    return mock_data
